package com.cln.treewalker;

public class SpecialTreeNode extends TreeNode {
	public SpecialTreeNode(String treeNodeString) {
		super(treeNodeString);
	}

	@Override
	public void accept(IVisitor v) {
		if (v instanceof TreePreOrderTraverser) {
			visitChild(v, this.getLeftChild());
			visitChild(v, this.getRightChild());
		}else{
			super.accept(v);
		}
	}

	private void visitChild(IVisitor v, TreeNode childNode) {
		if (childNode != null) {
			childNode.accept(v);
		}
	}
}
